-
Notifications
You must be signed in to change notification settings - Fork 417
Introduce FundingTransactionReadyForSignatures
event
#3889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
👋 Thanks for assigning @wpaulino as a reviewer! |
165d59d
to
8ca6d79
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3889 +/- ##
==========================================
- Coverage 89.01% 88.77% -0.25%
==========================================
Files 174 173 -1
Lines 124395 124755 +360
Branches 124395 124755 +360
==========================================
+ Hits 110730 110749 +19
- Misses 11187 11587 +400
+ Partials 2478 2419 -59
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1 similar comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
890633d
to
a1de384
Compare
🔔 2nd Reminder Hey @wpaulino! This PR has been waiting for your review. |
7df5779
to
c8f981c
Compare
🔔 3rd Reminder Hey @wpaulino! This PR has been waiting for your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there was a problem rebasing, but some comments that had been marked resolved weren't fixed.
Yeah, they got lost on a rebase and somehow lost the commit. Rebased to get the one CI fix in. Fixing. |
c15f426
to
ff1489d
Compare
🔔 4th Reminder Hey @wpaulino! This PR has been waiting for your review. |
ff1489d
to
0a586e6
Compare
🔔 5th Reminder Hey @wpaulino! This PR has been waiting for your review. |
🔔 6th Reminder Hey @wpaulino! This PR has been waiting for your review. |
a9e1a3a
to
83e78d6
Compare
07e3526
to
de9d375
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to review the last commit still.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the review!
Reworking the PR now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still working through those not marked resolved. I'll re-request review when they're ready.
fdf8e21
to
1fe02a7
Compare
fa4b4b1
to
60e8c7d
Compare
60e8c7d
to
91ce15f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it should be ready now.
91ce15f
to
04e66f1
Compare
04e66f1
to
381a990
Compare
The `FundingTransactionReadyForSignatures` event requests witnesses from the client for their contributed inputs to an interactively constructed transaction. The client calls `ChannelManager::funding_transaction_signed` to provide the witnesses to LDK. The `handle_channel_resumption` method handles resumption from both a channel re-establish and a monitor update. When the corresponding monitor update for the commitment_signed message completes, we will push the event here. We can thus only ever provide holder signatures after a monitor update has completed. We can also get rid of the reestablish code involved with `monitor_pending_tx_signatures` and remove that field too.
…hecks In a following commit, We'll use the contained scriptPubKeys to validate P2WPKH and P2TR key path spends and to assist in checking that signatures in provided holder witnesses use SIGHASH_ALL to prevent funds being frozen or held ransom.
LDK checks the following: * Each input spends an output that is one of P2WPKH, P2WSH, or P2TR. These were already checked by LDK when the inputs to be contributed were provided. * All signatures use the `SIGHASH_ALL` sighash type. * P2WPKH and P2TR key path spends are valid (verifies signatures) NOTE: * When checking P2WSH spends, LDK tries to decode 70-72 byte witness elements as ECDSA signatures with a sighash flag. If the internal DER-decoding fails, then LDK just assumes it wasn't a signature and carries with checks. If the element can be decoded as an ECDSA signature, the the sighash flag must be `SIGHASH_ALL`. * When checking P2TR script-path spends, LDK assumes all elements of exactly 65 bytes with the last byte matching any valid sighash flag byte are schnorr signatures and checks that the sighash type is `SIGHASH_ALL`. If the last byte is not any valid sighash flag, the element is assumed not to be a signature and is ignored. Elements of 64 bytes are not checked because if they were schnorr signatures then they would implicitly be `SIGHASH_DEFAULT` which is an alias of `SIGHASH_ALL`.
381a990
to
abba0a7
Compare
} | ||
|
||
fn maybe_broadcast_interactive_funding(&self, channel: &mut FundedChannel<SP>) { | ||
if let Some(ref funding_tx) = channel.funding.get_funding_transaction() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of splicing, it won't always be the channel.funding
transaction that needs to be broadcast. It's best to just return the transaction directly to the caller whenever we need to broadcast.
if holder_tx_signatures_opt.is_some() { | ||
self.context.channel_state.set_our_tx_signatures_ready(); | ||
if holder_tx_signatures_opt.is_none() { | ||
return Ok((funding_tx_opt, None)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we can clean up the return flow here with below
} | ||
None | ||
} else { | ||
if signing_session.local_inputs_count() > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this either, we'd likely reuse the same flow as initiators for acceptors that contributed and need an event
Cherry-picked from #3735 as it is relevant to splicing and will unblock testing after #3736 lands.
The
FundingTransactionReadyForSignatures
event requests witnesses from the client for their contributed inputs to an interactively constructed transaction.The client calls
ChannelManager::funding_transaction_signed
to provide the witnesses to LDK.